package com.party.poster.draw;


import com.party.poster.PosterElement;
import com.party.poster.element.Text;

import java.awt.*;

public class TextDraw implements PosterDraw {

    @Override
    public boolean draw(Graphics2D graphics, PosterElement element) {
        if (element instanceof Text == false){
            return false;
        }
        Text text = (Text) element;
        graphics.setFont(text.getFont());
        graphics.setColor(text.getColor());
        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        graphics.drawString(text.getText(),text.getPosition().getX(),text.getPosition().getY());
        return true;
    }

}
